luci-mod-network: organize "devices" tab in dhcp/dns views
authorDavid Härdeman <[email protected]>
Wed, 15 Oct 2025 16:02:21 +0000 (18:02 +0200)
committerPaul Donald <[email protected]>
Sat, 18 Oct 2025 21:51:38 +0000 (23:51 +0200)
Sort the options in the "devices" tab so that they are all grouped together in
the order they appear in the UI and delete ones that are specific to DNS from
dhcp.js and vice versa.

Note that this means that the "nonwildcard", "interface" and "notinterface"
options are present in both views, since they control the interfaces that
dnsmasq listens to both for DNS and DHCP.

We might consider adding a help text blurb explaining that, but I've
intentionally not changed any code in these patches.

Signed-off-by: David Härdeman <[email protected]>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js
modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js

index 1b4af65472f617472fbbca9a4c0068d722374caa..f029a3a7b8b55c88b26f599c4118fd4930cfca81 100644 (file)
@@ -419,6 +419,28 @@ return view.extend({
                o.optional = true;
                // End general
 
+               // Begin devices
+               o = s.taboption('devices', form.Flag, 'nonwildcard',
+                       _('Non-wildcard'),
+                       _('Bind only to configured interface addresses, instead of the wildcard address.'));
+               o.default = o.enabled;
+               o.optional = false;
+               o.rmempty = true;
+
+               o = s.taboption('devices', widgets.NetworkSelect, 'interface',
+                       _('Listen interfaces'),
+                       _('Listen only on the specified interfaces, and loopback if not excluded explicitly.'));
+               o.multiple = true;
+               o.nocreate = true;
+
+               o = s.taboption('devices', widgets.NetworkSelect, 'notinterface',
+                       _('Exclude interfaces'),
+                       _('Do not listen on the specified interfaces.'));
+               o.loopback = true;
+               o.multiple = true;
+               o.nocreate = true;
+               // End devices
+
                s.taboption('filteropts', form.Flag, 'domainneeded',
                        _('Domain required'),
                        _('Never forward DNS queries which lack dots or domain parts.') + '<br />' +
@@ -495,26 +517,6 @@ return view.extend({
                o.optional = false;
                o.rmempty = false;
 
-               o = s.taboption('devices', form.Flag, 'nonwildcard',
-                       _('Non-wildcard'),
-                       _('Bind only to configured interface addresses, instead of the wildcard address.'));
-               o.default = o.enabled;
-               o.optional = false;
-               o.rmempty = true;
-
-               o = s.taboption('devices', widgets.NetworkSelect, 'interface',
-                       _('Listen interfaces'),
-                       _('Listen only on the specified interfaces, and loopback if not excluded explicitly.'));
-               o.multiple = true;
-               o.nocreate = true;
-
-               o = s.taboption('devices', widgets.NetworkSelect, 'notinterface',
-                       _('Exclude interfaces'),
-                       _('Do not listen on the specified interfaces.'));
-               o.loopback = true;
-               o.multiple = true;
-               o.nocreate = true;
-
                o = s.taboption('relay', form.SectionValue, '__relays__', form.TableSection, 'relay', null,
                        _('Relay DHCP requests elsewhere. OK: v4↔v4, v6↔v6. Not OK: v4↔v6, v6↔v4.')
                        + '<br />' + _('Note: you may also need a DHCP Proxy (currently unavailable) when specifying a non-standard Relay To port(<code>addr#port</code>).')
@@ -731,36 +733,6 @@ return view.extend({
                o.optional = true;
                o.placeholder = '64.94.110.11';
 
-               o = s.taboption('devices', form.Value, 'port',
-                       _('DNS server port'),
-                       _('Listening port for inbound DNS queries.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = 53;
-
-               o = s.taboption('devices', form.Value, 'queryport',
-                       _('DNS query port'),
-                       _('Fixed source port for outbound DNS queries.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = _('any');
-
-               o = s.taboption('devices', form.Value, 'minport',
-                       _('Minimum source port #'),
-                       _('Min valid value %s.').format('<code>1024</code>') + ' ' + _('Useful for systems behind firewalls.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = 1024;
-               o.depends('queryport', '');
-
-               o = s.taboption('devices', form.Value, 'maxport',
-                       _('Maximum source port #'),
-                       _('Max valid value %s.').format('<code>65535</code>') + ' ' + _('Useful for systems behind firewalls.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = 50000;
-               o.depends('queryport', '');
-
                o = s.taboption('limits', form.Value, 'dhcpleasemax',
                        _('Max. DHCP leases'),
                        _('Maximum allowed number of active DHCP leases.'));
index 61b09b84a6a231734b3a0e08bf35264bc925ce27..9818181e86d726c763dcf980a9b65381435a51ce 100644 (file)
@@ -469,6 +469,58 @@ return view.extend({
                });
                // End cache
 
+               // Begin devices
+               o = s.taboption('devices', form.Flag, 'nonwildcard',
+                       _('Non-wildcard'),
+                       _('Bind only to configured interface addresses, instead of the wildcard address.'));
+               o.default = o.enabled;
+               o.optional = false;
+               o.rmempty = true;
+
+               o = s.taboption('devices', widgets.NetworkSelect, 'interface',
+                       _('Listen interfaces'),
+                       _('Listen only on the specified interfaces, and loopback if not excluded explicitly.'));
+               o.multiple = true;
+               o.nocreate = true;
+
+               o = s.taboption('devices', widgets.NetworkSelect, 'notinterface',
+                       _('Exclude interfaces'),
+                       _('Do not listen on the specified interfaces.'));
+               o.loopback = true;
+               o.multiple = true;
+               o.nocreate = true;
+
+               o = s.taboption('devices', form.Value, 'port',
+                       _('DNS server port'),
+                       _('Listening port for inbound DNS queries.'));
+               o.optional = true;
+               o.datatype = 'port';
+               o.placeholder = 53;
+
+               o = s.taboption('devices', form.Value, 'queryport',
+                       _('DNS query port'),
+                       _('Fixed source port for outbound DNS queries.'));
+               o.optional = true;
+               o.datatype = 'port';
+               o.placeholder = _('any');
+
+               o = s.taboption('devices', form.Value, 'minport',
+                       _('Minimum source port #'),
+                       _('Min valid value %s.').format('<code>1024</code>') + ' ' + _('Useful for systems behind firewalls.'));
+               o.optional = true;
+               o.datatype = 'port';
+               o.placeholder = 1024;
+               o.depends('queryport', '');
+
+               o = s.taboption('devices', form.Value, 'maxport',
+                       _('Maximum source port #'),
+                       _('Max valid value %s.').format('<code>65535</code>') + ' ' + _('Useful for systems behind firewalls.'));
+               o.optional = true;
+               o.datatype = 'port';
+               o.placeholder = 50000;
+               o.depends('queryport', '');
+               // End devices
+
                s.taboption('filteropts', form.Flag, 'domainneeded',
                        _('Domain required'),
                        _('Never forward DNS queries which lack dots or domain parts.') + '<br />' +
@@ -544,26 +596,6 @@ return view.extend({
                o.optional = false;
                o.rmempty = false;
 
-               o = s.taboption('devices', form.Flag, 'nonwildcard',
-                       _('Non-wildcard'),
-                       _('Bind only to configured interface addresses, instead of the wildcard address.'));
-               o.default = o.enabled;
-               o.optional = false;
-               o.rmempty = true;
-
-               o = s.taboption('devices', widgets.NetworkSelect, 'interface',
-                       _('Listen interfaces'),
-                       _('Listen only on the specified interfaces, and loopback if not excluded explicitly.'));
-               o.multiple = true;
-               o.nocreate = true;
-
-               o = s.taboption('devices', widgets.NetworkSelect, 'notinterface',
-                       _('Exclude interfaces'),
-                       _('Do not listen on the specified interfaces.'));
-               o.loopback = true;
-               o.multiple = true;
-               o.nocreate = true;
-
                o = s.taboption('relay', form.SectionValue, '__relays__', form.TableSection, 'relay', null,
                        _('Relay DHCP requests elsewhere. OK: v4↔v4, v6↔v6. Not OK: v4↔v6, v6↔v4.')
                        + '<br />' + _('Note: you may also need a DHCP Proxy (currently unavailable) when specifying a non-standard Relay To port(<code>addr#port</code>).')
@@ -780,36 +812,6 @@ return view.extend({
                o.optional = true;
                o.placeholder = '64.94.110.11';
 
-               o = s.taboption('devices', form.Value, 'port',
-                       _('DNS server port'),
-                       _('Listening port for inbound DNS queries.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = 53;
-
-               o = s.taboption('devices', form.Value, 'queryport',
-                       _('DNS query port'),
-                       _('Fixed source port for outbound DNS queries.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = _('any');
-
-               o = s.taboption('devices', form.Value, 'minport',
-                       _('Minimum source port #'),
-                       _('Min valid value %s.').format('<code>1024</code>') + ' ' + _('Useful for systems behind firewalls.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = 1024;
-               o.depends('queryport', '');
-
-               o = s.taboption('devices', form.Value, 'maxport',
-                       _('Maximum source port #'),
-                       _('Max valid value %s.').format('<code>65535</code>') + ' ' + _('Useful for systems behind firewalls.'));
-               o.optional = true;
-               o.datatype = 'port';
-               o.placeholder = 50000;
-               o.depends('queryport', '');
-
                o = s.taboption('limits', form.Value, 'dhcpleasemax',
                        _('Max. DHCP leases'),
                        _('Maximum allowed number of active DHCP leases.'));